
 <!DOCTYPE HTML>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  
    <title>前端 CHANGELOG 生成指南 | Here. There.</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=3, minimum-scale=1">
    
    <meta name="author" content="被删">
    
    <meta name="description" content="我们在多人协同开发的时候，经常会遇到版本打包发布时，需要手动收集更新了什么内容、修复了什么 BUG，如果日常开发中并没有养成 commit 的好习惯，我们在合入 CHANGELOG 的时候就很容易遗漏特性。本文记录前端常用的自动生成 CHANGELOG 的接入过程。">
    
    
    
    
    <link rel="alternate" href="/atom.xml" title="Here. There." type="application/atom+xml">
    
    
    <link rel="icon" href="/img/favicon.ico">
    
    
    <link rel="apple-touch-icon" href="/img/pacman.jpg">
    <link rel="apple-touch-icon-precomposed" href="/img/pacman.jpg">
    
    <link rel="stylesheet" href="/css/style.css">
    
<script type="text/javascript">
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "//hm.baidu.com/hm.js?3d902de4a19cf2bf179534ffd2dd7b7f";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</head>

  <body>
    <header>
      <div>
		
			<div id="imglogo">
				<a href="/"><img src="/img/sun.png" alt="Here. There." title="Here. There."/></a>
			</div>
			
			<div id="textlogo">
				<h1 class="site-name"><a href="/" title="Here. There.">Here. There.</a></h1>
				<h2 class="blog-motto">Love ice cream. Love sunshine. Love life. Love the world. Love myself. Love you.</h2>
			</div>
			<div class="navbar"><a class="navbutton navmobile" href="#" title="菜单">
			</a></div>
			<nav class="animated">
				<ul>
					
						<li><a href="/">首页</a></li>
					
						<li><a href="https://github.com/godbasin/godbasin.github.io">所有文章</a></li>
					
						<li><a href="/archives">归档</a></li>
					
						<li><a href="/categories">分类</a></li>
					
						<li><a href="https://godbasin.github.io/front-end-playground">前端游乐场</a></li>
					
						<li><a href="/about">关于我</a></li>
					
				</ul>
			</nav>			
</div>

    </header>
    <div id="container">
      <div id="main" class="post" itemscope itemprop="blogPost">
	<article itemprop="articleBody"> 
		<header class="article-info clearfix">
  <h1 itemprop="name">
    
      <a href="/2019/11/10/change-log/" title="前端 CHANGELOG 生成指南" itemprop="url">前端 CHANGELOG 生成指南</a>
  </h1>
  <p class="article-author">By
    
      <a href="https://godbasin.github.io" title="被删">被删</a>
    </p>
  <p class="article-time">
    <time datetime="2019-11-10T02:40:25.000Z" itemprop="datePublished">2019-11-10</time>
    更新日期:<time datetime="2019-11-10T02:41:44.351Z" itemprop="dateModified">2019-11-10</time>
    
  </p>
</header>
	<div class="article-content">
		
		
		<div id="toc" class="toc-article">
			<strong class="toc-title">文章目录</strong>
		<ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Commit-规范化"><span class="toc-number">1.</span> <span class="toc-text">Commit 规范化</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Angular-规范"><span class="toc-number">1.1.</span> <span class="toc-text">Angular 规范</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#conventional-changelog-方案"><span class="toc-number">1.2.</span> <span class="toc-text">conventional-changelog 方案</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#conventional-changelog-介绍"><span class="toc-number">1.2.1.</span> <span class="toc-text">conventional-changelog 介绍</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#支持-Conventional-Changelog-的插件"><span class="toc-number">1.2.1.1.</span> <span class="toc-text">支持 Conventional Changelog 的插件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Conventional-Changelog-生态系统重要的模块"><span class="toc-number">1.2.1.2.</span> <span class="toc-text">Conventional Changelog 生态系统重要的模块</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#规范-commit-命令行工具–commitizen"><span class="toc-number">1.2.2.</span> <span class="toc-text">规范 commit 命令行工具–commitizen</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#强制执行-commit-规范–commitlint-husky"><span class="toc-number">1.2.3.</span> <span class="toc-text">强制执行 commit 规范–commitlint+husky</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#自动生成-CHANGELOG–conventional-changelog-cli"><span class="toc-number">1.2.4.</span> <span class="toc-text">自动生成 CHANGELOG–conventional-changelog-cli</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#参考"><span class="toc-number">1.2.5.</span> <span class="toc-text">参考</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#结束语"><span class="toc-number">1.3.</span> <span class="toc-text">结束语</span></a></li></ol></li></ol>
		</div>
		
		<p>我们在多人协同开发的时候，经常会遇到版本打包发布时，需要手动收集更新了什么内容、修复了什么 BUG，如果日常开发中并没有养成 commit 的好习惯，我们在合入 CHANGELOG 的时候就很容易遗漏特性。本文记录前端常用的自动生成 CHANGELOG 的接入过程。<br><a id="more"></a></p>
<h1 id="Commit-规范化"><a href="#Commit-规范化" class="headerlink" title="Commit 规范化"></a>Commit 规范化</h1><p>不管是哪种自动生成 CHANGELOG 的工具，基本上都依赖于每次提交 git commit 的信息。从 git commit 信息开始进行规范化，这样就可以通过工具把关键信息找出来，并自动生成到 CHANGELOG 中。</p>
<h2 id="Angular-规范"><a href="#Angular-规范" class="headerlink" title="Angular 规范"></a>Angular 规范</h2><p>目前，社区有多种 Commit message 的写法规范，这里我们使用的是 <a href="https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#heading=h.greljkmo14y0" target="_blank" rel="external">Angular 规范</a>，这是目前使用最广的写法，比较合理和系统化，并且有配套的工具（参考<a href="https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html" target="_blank" rel="external">《Commit message 和 Change log 编写指南》</a>）。</p>
<p>每次提交，Commit message 都包括三个部分：Header（必须），Body（可省略） 和 Footer（可省略）。</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&lt;<span class="built_in">type</span>, 必填&gt;(&lt;scope，可省略&gt;): &lt;subject，必填&gt;</div><div class="line">// 空一行</div><div class="line">&lt;body，可省略&gt;</div><div class="line">// 空一行</div><div class="line">&lt;footer，可省略&gt;</div></pre></td></tr></table></figure>
<ol>
<li><code>type</code>。<code>type</code>用于说明 commit 的类别，一般来说只允许使用下面7个标识：</li>
</ol>
<table>
<thead>
<tr>
<th>标识名</th>
<th>说明</th>
<th>是否会出现在 CHANGELOG 中</th>
</tr>
</thead>
<tbody>
<tr>
<td>feat</td>
<td>新功能（feature）</td>
<td>会</td>
</tr>
<tr>
<td>fix</td>
<td>修补bug</td>
<td>会</td>
</tr>
<tr>
<td>docs</td>
<td>文档（documentation）</td>
<td>自行决定</td>
</tr>
<tr>
<td>style</td>
<td>格式（不影响代码运行的变动）</td>
<td>自行决定</td>
</tr>
<tr>
<td>refactor</td>
<td>重构（即不是新增功能，也不是修改bug的代码变动）</td>
<td>自行决定</td>
</tr>
<tr>
<td>test</td>
<td>增加测试</td>
<td>自行决定</td>
</tr>
<tr>
<td>chore</td>
<td>构建过程或辅助工具的变动</td>
<td>自行决定</td>
</tr>
</tbody>
</table>
<ol>
<li><code>scope</code>。<code>scope</code>用于说明 commit 影响的范围，比如某个模块、某个功能。</li>
<li><code>subject</code>。<code>subject</code>是 commit 目的的简短描述，不超过50个字符。</li>
<li><code>body</code>。<code>body</code>部分是对本次 commit 的详细描述，可以分成多行。</li>
<li><code>footer</code>。<code>footer</code>部分只用于两种情况：不兼容变动、关闭 Issue。</li>
</ol>
<h2 id="conventional-changelog-方案"><a href="#conventional-changelog-方案" class="headerlink" title="conventional-changelog 方案"></a>conventional-changelog 方案</h2><p>关于自动生成 CHANGELOG，社区中使用较多的则是 <a href="https://github.com/conventional-changelog/conventional-changelog" target="_blank" rel="external">conventional-changelog</a> 方案。</p>
<h3 id="conventional-changelog-介绍"><a href="#conventional-changelog-介绍" class="headerlink" title="conventional-changelog 介绍"></a>conventional-changelog 介绍</h3><p><a href="https://github.com/conventional-changelog/conventional-changelog" target="_blank" rel="external">conventional-changelog</a> 可以根据项目的 commit 和 metadata 信息自动生成 CHANGELOG 和 release notes的系列工具，并且在辅助 standard-version 工具的情况下，可以自动帮你完成生成version、打tag, 生成CHANGELOG等系列过程。（参考<a href="https://zhuanlan.zhihu.com/p/51894196" target="_blank" rel="external">《git commit 、CHANGELOG 和版本发布的标准自动化》</a>）</p>
<h4 id="支持-Conventional-Changelog-的插件"><a href="#支持-Conventional-Changelog-的插件" class="headerlink" title="支持 Conventional Changelog 的插件"></a>支持 Conventional Changelog 的插件</h4><ul>
<li><a href="https://github.com/btford/grunt-conventional-changelog" target="_blank" rel="external">grunt</a></li>
<li><a href="https://github.com/conventional-changelog/gulp-conventional-changelog" target="_blank" rel="external">gulp</a></li>
<li><a href="https://github.com/conventional-changelog/atom-conventional-changelog" target="_blank" rel="external">atom</a></li>
<li><a href="https://github.com/axetroy/vscode-changelog-generator" target="_blank" rel="external">vscode</a></li>
</ul>
<h4 id="Conventional-Changelog-生态系统重要的模块"><a href="#Conventional-Changelog-生态系统重要的模块" class="headerlink" title="Conventional Changelog 生态系统重要的模块"></a>Conventional Changelog 生态系统重要的模块</h4><ul>
<li><a href="https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-cli" target="_blank" rel="external">conventional-changelog-cli</a> - 功能齐全的核心命令行工具</li>
<li><a href="https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/standard-changelog" target="_blank" rel="external">standard-changelog</a> - 针对 angular commit 格式的命令行工具</li>
<li><a href="https://github.com/conventional-changelog/conventional-github-releaser" target="_blank" rel="external">conventional-github-releaser</a> - 利用 git metadata 针对 Github 的发布工具</li>
<li><a href="https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-recommended-bump" target="_blank" rel="external">conventional-recommended-bump</a> - 根据 commit message 判断需要升级哪一位版本号</li>
<li><a href="https://github.com/conventional-changelog/conventional-commits-detector" target="_blank" rel="external">conventional-commits-detector</a> - commit message 规范引用检测</li>
<li><a href="https://github.com/commitizen/cz-cli" target="_blank" rel="external">commitizen</a> - 针对开发者简单的 commit 规范</li>
<li><a href="https://github.com/conventional-changelog/commitlint" target="_blank" rel="external">commitlint</a> - commit Lint 工具</li>
</ul>
<p>以上是 conventional-changelog 生态重要的几个主要模块，实际工作中这几个工具常常是配套使用的，我们也是可以根据自己的情况来挑着使用。</p>
<h3 id="规范-commit-命令行工具–commitizen"><a href="#规范-commit-命令行工具–commitizen" class="headerlink" title="规范 commit 命令行工具–commitizen"></a>规范 commit 命令行工具–commitizen</h3><p>一般来说，我们提供一个脚本工具给到开发者来按照指引生成符合规范的 commit 信息也是够用的，这里我们使用<code>commitizen</code>工具。</p>
<ol>
<li>安装<code>commitizen</code>：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g commitizen</div></pre></td></tr></table></figure>
<ol>
<li>通过以下命令来初始化项目以使用<code>cz-conventional-changelog</code>适配器（每个项目和构建过程都有不同的要求，因此commitizen通过适配器的方式，来保持Commitizen的扩展性）：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">commitizen init cz-conventional-changelog --save-dev --save-exact</div></pre></td></tr></table></figure>
<p>该命令做以下三件事情：</p>
<ul>
<li>安装<code>cz-conventional-changelog</code>适配器npm模块</li>
<li>将其保存到<code>package.json</code>的依赖项或<code>devDependencies</code></li>
<li>将<code>config.commitizen</code>配置添加到<code>package.json</code>的根目录，该配置告诉<code>commitizen</code>，当我们尝试提交此仓库时，我们实际上希望使用哪个适配器</li>
</ul>
<ol>
<li>我们可以通过执行<code>git cz</code>命令，来提交 git commit：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div></pre></td><td class="code"><pre><div class="line">&gt; git cz</div><div class="line"></div><div class="line">cz-cli@<span class="number">4</span>.<span class="number">0</span>.<span class="number">3</span>, cz-conventional-changelog@<span class="number">3</span>.<span class="number">0</span>.<span class="number">2</span></div><div class="line"></div><div class="line">? Select the <span class="built_in">type</span> of change that you're committing: (Use arrow keys)</div><div class="line">&gt; feat:        A new feature</div><div class="line"><span class="function">  fix:         <span class="title">A</span> <span class="title">bug</span> <span class="title">fix</span></span></div><div class="line">  <span class="title">improvement</span>: <span class="title">An</span> <span class="title">improvement</span> <span class="title">to</span> <span class="title">a</span> <span class="title">current</span> <span class="title">feature</span></div><div class="line">  <span class="title">docs</span>:        <span class="title">Documentation</span> <span class="title">only</span> <span class="title">changes</span></div><div class="line">  <span class="title">style</span>:       <span class="title">Changes</span> <span class="title">that</span> <span class="title">do</span> <span class="title">not</span> <span class="title">affect</span> <span class="title">the</span> <span class="title">meaning</span> <span class="title">of</span> <span class="title">the</span> <span class="title">code</span> (<span class="title">white</span>-<span class="title">space</span>, <span class="title">formatting</span>, <span class="title">missing</span> <span class="title">semi</span>-<span class="title">colons</span>, <span class="title">etc</span>)</div><div class="line">  <span class="title">refactor</span>:    <span class="title">A</span> <span class="title">code</span> <span class="title">change</span> <span class="title">that</span> <span class="title">neither</span> <span class="title">fixes</span> <span class="title">a</span> <span class="title">bug</span> <span class="title">nor</span> <span class="title">adds</span> <span class="title">a</span> <span class="title">feature</span></div><div class="line">  <span class="title">perf</span>:        <span class="title">A</span> <span class="title">code</span> <span class="title">change</span> <span class="title">that</span> <span class="title">improves</span> <span class="title">performance</span></div><div class="line">(<span class="title">Move</span> <span class="title">up</span> <span class="title">and</span> <span class="title">down</span> <span class="title">to</span> <span class="title">reveal</span> <span class="title">more</span> <span class="title">choices</span>)</div></pre></td></tr></table></figure>
<h3 id="强制执行-commit-规范–commitlint-husky"><a href="#强制执行-commit-规范–commitlint-husky" class="headerlink" title="强制执行 commit 规范–commitlint+husky"></a>强制执行 commit 规范–commitlint+husky</h3><p>使用<code>commitizen</code>工具，我们可以通过执行<code>git cz</code>命令来提交符合规范的 commit 信息，但是在日常开发中，很多小伙伴并不是通过命令行的方式来提交 commit 的，如果我们要强制校验其他人通过 vscode/webstorm 等其他工具的方式提交 commit，可以使用<code>commitlint</code>+<code>husky</code>的方式来配合使用。</p>
<ol>
<li><code>commitlint</code>检查我们的 commit message 是否符合常规的提交格式，可通过以下方式安装：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install --save-dev @commitlint/config-conventional @commitlint/cli</div></pre></td></tr></table></figure>
<ol>
<li>在<code>package.json</code>中添加配置（还可以通过<code>commitlint.config.js</code>，<code>.commitlintrc.js</code>，<code>.commitlintrc.json</code>，或<code>.commitlintrc.yml</code>文件等方式配置），此处<code>@commitlint/config-conventional</code>为基于 Angular 格式的配置：</li>
</ol>
<figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&#123;  </div><div class="line">  <span class="attr">"commitlint"</span>: &#123;</div><div class="line">    <span class="attr">"extends"</span>: [<span class="string">"@commitlint/config-conventional"</span>]</div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<ol>
<li><code>husky</code>继承了 git 下所有的钩子，在触发钩子的时候，<code>husky</code>可以阻止不合法的 commit、push 等等。安装<code>husky</code>：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install husky --save-dev</div></pre></td></tr></table></figure>
<ol>
<li>使用<code>husky</code>添加 commit-msg 的钩子，用于检查<code>commitlint</code>规范：</li>
</ol>
<figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">  <span class="attr">"husky"</span>: &#123;</div><div class="line">    <span class="attr">"hooks"</span>: &#123;</div><div class="line">      <span class="attr">"commit-msg"</span>: <span class="string">"commitlint -E HUSKY_GIT_PARAMS"</span></div><div class="line">    &#125;</div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>这样，不管我们通过什么方式来提交 commit，如果 commit 信息不符合我们的规范，都会进行报错。例如我提交内容为<code>test</code>的 commit，会进行以下报错：</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div></pre></td><td class="code"><pre><div class="line">husky &gt; commit-msg (node v10.<span class="number">16</span>.<span class="number">2</span>)</div><div class="line">⧗   input: test</div><div class="line">✖   subject may <span class="keyword">not</span> be empty [subject-empty]</div><div class="line">✖   <span class="built_in">type</span> may <span class="keyword">not</span> be empty [<span class="built_in">type</span>-empty]</div><div class="line"></div><div class="line">✖   found <span class="number">2</span> problems, <span class="number">0</span> warnings</div><div class="line">ⓘ   Get <span class="built_in">help</span>: https://github.com/conventional-changelog/commitlint/#what-is-commitlint</div></pre></td></tr></table></figure>
<h3 id="自动生成-CHANGELOG–conventional-changelog-cli"><a href="#自动生成-CHANGELOG–conventional-changelog-cli" class="headerlink" title="自动生成 CHANGELOG–conventional-changelog-cli"></a>自动生成 CHANGELOG–conventional-changelog-cli</h3><p>如果你的所有 Commit 都符合 Angular 格式，那么发布新版本时， CHANGELOG 就可以用脚本自动生成。</p>
<ol>
<li>conventional-changelog-cli 就是生成 CHANGELOG 的工具，我们首先来安装一下：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g conventional-changelog-cli</div></pre></td></tr></table></figure>
<ol>
<li>通过执行以下命令，则可以生成 CHANGELOG.md 文件：</li>
</ol>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">conventional-changelog -p angular -i CHANGELOG.<span class="built_in">md</span> -s</div></pre></td></tr></table></figure>
<p>我们也可以将该命令配置到<code>scripts</code>中，就可以通过执行<code>npm run changelog</code>命令来生成 CHANGELOG 了:</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">&#123;</div><div class="line">  <span class="attr">"scripts"</span>: &#123;</div><div class="line">    <span class="attr">"changelog"</span>: <span class="string">"conventional-changelog -p angular -i CHANGELOG.md -s"</span></div><div class="line">  &#125;</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>生成的 CHANGELOG 最终样式如下：</p>
<figure class="highlight md"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line"><span class="section"># 1.0.0 (2019-11-06)</span></div><div class="line"></div><div class="line"><span class="section">### Features</span></div><div class="line"></div><div class="line"><span class="bullet">- </span><span class="strong">**自动化:**</span> 新增自动生成 CHANGELOG 相关功能 ([<span class="string">a9ebf7e</span>](<span class="link">https://github.com/godbasin/wxapp-typescript-demo/commit/a9ebf7ee0ca53a4906ed77106b65f6d6bef92f9b</span>))</div></pre></td></tr></table></figure>
<p>最终的代码可参考<a href="https://github.com/godbasin/wxapp-typescript-demo" target="_blank" rel="external">wxapp-typescript-demo</a>。</p>
<h3 id="参考"><a href="#参考" class="headerlink" title="参考"></a>参考</h3><ul>
<li><a href="https://www.ruanyifeng.com/blog/2016/01/commit_message_change_log.html" target="_blank" rel="external">《Commit message 和 Change log 编写指南》</a></li>
<li><a href="https://zhuanlan.zhihu.com/p/51894196" target="_blank" rel="external">《git commit 、CHANGELOG 和版本发布的标准自动化》</a></li>
</ul>
<h2 id="结束语"><a href="#结束语" class="headerlink" title="结束语"></a>结束语</h2><hr>
<p>自动生成 CHANGELOG 其实是一个很好用的功能，同时其实前端自动化还会包括 CI/CD、自动化测试等功能。将一些重复性的工作进行脚本化和工具化，不正是我们程序员最擅长做的一些事情吗？</p>
  
		
		<p style="margin-top:50px;">
			查看Github有更多内容噢：<a href="https://github.com/godbasin">https://github.com/godbasin</a>
			<br>
			更欢迎来<a href="https://godbasin.github.io/front-end-playground">被删的前端游乐场</a>边撸猫边学前端噢
		</p>
	</div>
	<img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/2code2.jpg" width="200" height="200" style="display:block;margin: 0 auto;" />
	<p style="text-align: center;margin-top: 10px;margin-bottom: 20px;">码生艰难，写文不易，给我家猪囤点猫粮了喵~</p>
	<div class="author-right">
  		<p>作者：被删</p>
  		<p>出处：<a href="https://godbasin.github.io">https://godbasin.github.io</a></p>
  		<p>本文版权归作者所有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</p>
	</div>
		<footer class="article-footer clearfix">

  <div class="article-tags">
  
  <span></span> <a href="/tags/教程/">教程</a>
  </div>


<div class="article-categories">
  <span></span>
  <a class="article-category-link" href="/categories/自动化甜筒/">自动化甜筒</a>
</div>



<div class="article-share" id="share">

  
<!-- JiaThis Button BEGIN -->
<div class="jiathis_style_24x24">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_weixin"></a>
	<a class="jiathis_button_renren"></a>
	<a href="http://www.jiathis.com/share?uid=2134021" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
</div>
<script type="text/javascript">
var jiathis_config = {data_track_clickback:'true'};
</script>
<script type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js?uid=2134021" charset="utf-8"></script>
<!-- JiaThis Button END -->   


</div>
</footer>   	       
	</article>
	
<nav class="article-nav clearfix">
 
 <div class="prev" >
 <a href="/2019/11/15/wxapp-latest-20191115/" title="小程序开发月刊第11期（20191115）">
  <strong>PREVIOUS:</strong><br/>
  <span>
  小程序开发月刊第11期（20191115）</span>
</a>
</div>


<div class="next">
<a href="/2019/11/09/wxapp-global-data-behavior/"  title="小程序的奇技淫巧 -- globalDataBehavior管理全局状态">
 <strong>NEXT:</strong><br/> 
 <span>小程序的奇技淫巧 -- globalDataBehavior管理全局状态
</span>
</a>
</div>

</nav>

	<!-- 如果不是首页且没使用 `comments: false` 关闭评论，则尝试加载评论 -->

    <!-- 配置中启用多说时，导入相应代码 -->
    


</div>  
      <div class="openaside"><a class="navbutton" href="#" title="显示侧边栏"></a></div>

  <div id="toc" class="toc-aside">
  <strong class="toc-title">文章目录</strong>
  <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Commit-规范化"><span class="toc-number">1.</span> <span class="toc-text">Commit 规范化</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Angular-规范"><span class="toc-number">1.1.</span> <span class="toc-text">Angular 规范</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#conventional-changelog-方案"><span class="toc-number">1.2.</span> <span class="toc-text">conventional-changelog 方案</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#conventional-changelog-介绍"><span class="toc-number">1.2.1.</span> <span class="toc-text">conventional-changelog 介绍</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#支持-Conventional-Changelog-的插件"><span class="toc-number">1.2.1.1.</span> <span class="toc-text">支持 Conventional Changelog 的插件</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Conventional-Changelog-生态系统重要的模块"><span class="toc-number">1.2.1.2.</span> <span class="toc-text">Conventional Changelog 生态系统重要的模块</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#规范-commit-命令行工具–commitizen"><span class="toc-number">1.2.2.</span> <span class="toc-text">规范 commit 命令行工具–commitizen</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#强制执行-commit-规范–commitlint-husky"><span class="toc-number">1.2.3.</span> <span class="toc-text">强制执行 commit 规范–commitlint+husky</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#自动生成-CHANGELOG–conventional-changelog-cli"><span class="toc-number">1.2.4.</span> <span class="toc-text">自动生成 CHANGELOG–conventional-changelog-cli</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#参考"><span class="toc-number">1.2.5.</span> <span class="toc-text">参考</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#结束语"><span class="toc-number">1.3.</span> <span class="toc-text">结束语</span></a></li></ol></li></ol>
  </div>

<div id="asidepart">
<div class="closeaside"><a class="closebutton" href="#" title="隐藏侧边栏"></a></div>
<aside class="clearfix">

  	
	<div class="archiveslist">
		<p class="asidetitle">最近文章</p>
			<ul class="archive-list">
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/11/15/wxapp-latest-20191115/" title="小程序开发月刊第11期（20191115）">小程序开发月刊第11期（201911...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/11/10/change-log/" title="前端 CHANGELOG 生成指南">前端 CHANGELOG 生成指南...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/11/09/wxapp-global-data-behavior/" title="小程序的奇技淫巧 -- globalDataBehavior管理全局状态">小程序的奇技淫巧 -- global...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/10/15/wxapp-latest-20191015/" title="小程序开发月刊第十期（20191015）">小程序开发月刊第十期（2019101...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/10/13/about-front-end-3-growth/" title="前端这几年--3.关于成长和焦虑">前端这几年--3.关于成长和焦虑...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/09/16/wxapp-latest-20190916/" title="小程序开发月刊第九期（20190916）">小程序开发月刊第九期（2019091...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/08/15/wxapp-latest-20190815/" title="小程序开发月刊第八期（20190815）">小程序开发月刊第八期（2019081...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/07/27/front-end-playground/" title="被删的前端游乐场建成！">被删的前端游乐场建成！</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/07/21/vue-for-everyone-3/" title="9102全员学Vue--3.把页面拼成个Web应用">9102全员学Vue--3.把页面拼...</a>
				</li>
				
			
					
				<li class="archive-list-item">
					<a class="archive-list-link" href="/2019/07/15/wxapp-latest-20190715/" title="小程序开发月刊第七期（20190715）">小程序开发月刊第七期（2019071...</a>
				</li>
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
				
			
			</ul>
	</div>


  
  <div class="archiveslist">
    <p class="asidetitle"><a href="/archives">归档</a></p>
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/11/">十一月 2019</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/10/">十月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/09/">九月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/08/">八月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/07/">七月 2019</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/06/">六月 2019</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/05/">五月 2019</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/04/">四月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/03/">三月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/02/">二月 2019</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2019/01/">一月 2019</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/12/">十二月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/11/">十一月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/10/">十月 2018</a><span class="archive-list-count">1</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/09/">九月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/08/">八月 2018</a><span class="archive-list-count">2</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/07/">七月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/06/">六月 2018</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/05/">五月 2018</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/04/">四月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/03/">三月 2018</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/02/">二月 2018</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2018/01/">一月 2018</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/12/">十二月 2017</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/11/">十一月 2017</a><span class="archive-list-count">3</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/10/">十月 2017</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/09/">九月 2017</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/08/">八月 2017</a><span class="archive-list-count">11</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/07/">七月 2017</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/06/">六月 2017</a><span class="archive-list-count">10</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/05/">五月 2017</a><span class="archive-list-count">15</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/04/">四月 2017</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/03/">三月 2017</a><span class="archive-list-count">10</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/02/">二月 2017</a><span class="archive-list-count">41</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2017/01/">一月 2017</a><span class="archive-list-count">6</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/12/">十二月 2016</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/11/">十一月 2016</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/10/">十月 2016</a><span class="archive-list-count">5</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/09/">九月 2016</a><span class="archive-list-count">7</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/08/">八月 2016</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/07/">七月 2016</a><span class="archive-list-count">14</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2016/06/">六月 2016</a><span class="archive-list-count">9</span></li></ul>
  </div>


  
<div class="archiveslist">
	<p class="asidetitle"><a href="/categories">分类</a></p>
		<ul class="archive-list">
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/CSS炒饭/" title="CSS炒饭">CSS炒饭<sup>3</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/D3小馒头/" title="D3小馒头">D3小馒头<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/angular2火锅/" title="angular2火锅">angular2火锅<sup>25</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/angular混搭/" title="angular混搭">angular混搭<sup>33</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/box2djs方糖/" title="box2djs方糖">box2djs方糖<sup>34</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/cyclejs哈根达斯/" title="cyclejs哈根达斯">cyclejs哈根达斯<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/jQuery杂烩/" title="jQuery杂烩">jQuery杂烩<sup>3</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/js什锦/" title="js什锦">js什锦<sup>26</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/react沙拉/" title="react沙拉">react沙拉<sup>16</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/three-js奶茶/" title="three.js奶茶">three.js奶茶<sup>5</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/vue八宝粥/" title="vue八宝粥">vue八宝粥<sup>29</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/webpack宾治/" title="webpack宾治">webpack宾治<sup>9</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/web乱炖/" title="web乱炖">web乱炖<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/前端满汉全席/" title="前端满汉全席">前端满汉全席<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/喵/" title="喵">喵<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/小程序双皮奶/" title="小程序双皮奶">小程序双皮奶<sup>27</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/工作这杯茶/" title="工作这杯茶">工作这杯茶<sup>5</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/应用巧克力盒/" title="应用巧克力盒">应用巧克力盒<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/思想棉花糖/" title="思想棉花糖">思想棉花糖<sup>8</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/柴米油盐工具集/" title="柴米油盐工具集">柴米油盐工具集<sup>1</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/自动化甜筒/" title="自动化甜筒">自动化甜筒<sup>1</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/categories/非前端钙片/" title="非前端钙片">非前端钙片<sup>7</sup></a>
			</li>
		
		</ul>
</div>


  
<div class="archiveslist">
	<p class="asidetitle">标签</p>
		<ul class="archive-list">
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/分享/" title="分享">分享<sup>44</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/原创部件/" title="原创部件">原创部件<sup>1</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/心态/" title="心态">心态<sup>5</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/教程/" title="教程">教程<sup>73</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/晒猫/" title="晒猫">晒猫<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/笔记/" title="笔记">笔记<sup>121</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/算法/" title="算法">算法<sup>9</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/自制插件/" title="自制插件">自制插件<sup>2</sup></a>
			</li>
		
			<li class="archive-list-item">
				<a class="archive-list-link" href="/tags/逻辑实现/" title="逻辑实现">逻辑实现<sup>5</sup></a>
			</li>
		
		</ul>
</div>


    <div class="archiveslist">
    <p class="asidetitle"><a href="/archives">about</a></p>
      <ul class="archive-list">
      	<li class="archive-list-item">
      		<a>wangbeishan@163.com</a>
      		<a href="https://github.com/godbasin">github.com/godbasin</a>
      	</li>
      </ul>
  </div>

  <div class="rsspart">
	<a href="/atom.xml" target="_blank" title="rss">RSS 订阅</a>
</div>

</aside>
</div>
    </div>
    <footer><div id="footer" >
	
	<section class="info">
		<p> 即使梦想再小，却很伟大 ^_^ </p>
	</section>
	 
		<p class="copyright">Powered by <a href="http://hexo.io" target="_blank" title="hexo">hexo</a> and Theme by <a href="https://github.com/A-limon/pacman" target="_blank" title="Pacman">Pacman</a> © 2019 
		
		<a href="https://godbasin.github.io" target="_blank" title="被删">被删</a>
		
		</p>
</div>
</footer>
    <script src="/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
  $('.navbar').click(function(){
    $('header nav').toggleClass('shownav');
  });
  var myWidth = 0;
  function getSize(){
    if( typeof( window.innerWidth ) == 'number' ) {
      myWidth = window.innerWidth;
    } else if( document.documentElement && document.documentElement.clientWidth) {
      myWidth = document.documentElement.clientWidth;
    };
  };
  var m = $('#main'),
      a = $('#asidepart'),
      c = $('.closeaside'),
      o = $('.openaside');
  $(window).resize(function(){
    getSize(); 
    if (myWidth >= 1024) {
      $('header nav').removeClass('shownav');
    }else
    {
      m.removeClass('moveMain');
      a.css('display', 'block').removeClass('fadeOut');
      o.css('display', 'none');
      
      $('#toc.toc-aside').css('display', 'none');
        
    }
  });
  c.click(function(){
    a.addClass('fadeOut').css('display', 'none');
    o.css('display', 'block').addClass('fadeIn');
    m.addClass('moveMain');
  });
  o.click(function(){
    o.css('display', 'none').removeClass('beforeFadeIn');
    a.css('display', 'block').removeClass('fadeOut').addClass('fadeIn');      
    m.removeClass('moveMain');
  });
  $(window).scroll(function(){
    o.css("top",Math.max(80,260-$(this).scrollTop()));
  });
});
</script>

<script type="text/javascript">
$(document).ready(function(){ 
  var ai = $('.article-content>iframe'),
      ae = $('.article-content>embed'),
      t  = $('#toc'),
      h  = $('article h2')
      ah = $('article h2'),
      ta = $('#toc.toc-aside'),
      o  = $('.openaside'),
      c  = $('.closeaside');
  if(ai.length>0){
    ai.wrap('<div class="video-container" />');
  };
  if(ae.length>0){
   ae.wrap('<div class="video-container" />');
  };
  if(ah.length==0){
    t.css('display','none');
  }else{
    c.click(function(){
      ta.css('display', 'block').addClass('fadeIn');
    });
    o.click(function(){
      ta.css('display', 'none');
    });
    $(window).scroll(function(){
      ta.css("top",Math.max(140,320-$(this).scrollTop()));
    });
  };
});
</script>







  </body>
</html>
